Hybrid Search
POST
http://${MILVUS_URI}/v2/vectordb/entities/hybrid_search
Example
export MILVUS_URI="localhost:19530"
curl --request POST \
--url "http://${MILVUS_URI}/v2/vectordb/entities/hybrid_search" \
--header "Request-Timeout: 0" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "test_collection",
"search": [
{
"data": [
[
0.673437956701697,
0.739243747672878
]
],
"annsField": "float_vector_1",
"limit": 10,
"outputFields": [
"*"
]
},
{
"data": [
[
0.075384179256879,
0.9971545645073111
]
],
"annsField": "float_vector_2",
"limit": 10,
"outputFields": [
"*"
]
}
],
"rerank": {
"strategy": "rrf",
"params": {
"k": 10
}
},
"limit": 3,
"outputFields": [
"user_id",
"word_count",
"book_describe"
]
}'
Possible response is similar to the following.
{
"code": 0,
"cost": 0,
"data": [
{
"book_describe": "book_105",
"distance": 0.09090909,
"id": 450519760774180800,
"user_id": 5,
"word_count": 105
},
{
"book_describe": "book_246",
"distance": 0.09090909,
"id": 450519760774180900,
"user_id": 46,
"word_count": 246
},
{
"book_describe": "book_367",
"distance": 0.08333333600000001,
"id": 450519760774181060,
"user_id": 67,
"word_count": 367
}
]
}
Request
Parameters
Header parameters
Parameter Description Request-Timeout
integer
The timeout duration for this operation.
Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.Authorization
string
The authentication token.No query parameters required
No path parameters required
Request Body
{
"dbName": "string",
"collectionName": "string",
"partitionNames": [],
"search": [
{
"data": [],
"annsField": "string",
"filter": "string",
"groupingField": "string",
"metricType": "string",
"limit": "integer",
"offset": "integer",
"ignoreGrowing": "boolean",
"params": {
"radius": "integer",
"range_filter": "integer"
}
}
],
"rerank": "string",
"limit": "integer",
"outputFields": []
}
Parameter | Description |
---|---|
dbName | string The name of the database. |
collectionName * | string The name of the collection to which this operation applies. |
partitionNames | array The name of the partitions to which this operation applies. |
partitionNames[] | string PartitionName |
search | array |
search[] | object The parameter settings specific to this operation. |
search[][].data | array A list of vector embeddings. |
search[][].data[] | number A vector embedding |
search[].annsField | string |
search[].filter | string |
search[].groupingField | string |
search[].metricType | string The name of the metric type that applies to the current search. The value should be the same as the metric type of the target collection. The value defaults to COSINE |
search[].limit | integer |
search[].offset | integer |
search[].ignoreGrowing | boolean |
search[].params | object Extra search parameters. |
search[].params.radius | integer Determines the threshold of least similarity. When setting metric_type to L2, ensure that this value is greater than that of range_filter. Otherwise, this value should be lower than that of range_filter. |
search[].params.range_filter | integer Refines the search to vectors within a specific similarity range. When setting metric_type to IP or COSINE, ensure that this value is greater than that of radius. Otherwise, this value should be lower than that of radius. |
rerank * | string |
limit | integer The total number of entities to return. You can use this parameter in combination with offset in param to enable pagination. The sum of this value and offset in param should be less than 16,384. |
outputFields | array An array of fields to return along with the search results. |
outputFields[] | string A field name |
Response
Returns the search results.
Response Bodies
- Response body if we process your request successfully
{
"code": "integer",
"data": [
{}
]
}
- Response body if we failed to process your request
{
"code": integer,
"message": string
}
Properties
The properties in the returned response are listed in the following table.
Property | Description |
---|---|
code | integer Indicates whether the request succeeds.
|
message | string Indicates the possible reason for the reported error. |
data | array |
data[] | object |